﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using eLoje_Model;
using Eloje_Data;

namespace ELoje_web
{
    public partial class FornecedorNew : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                applyText();
                navigationHistory();

            }
        }

        //protected void gvConfia_DataBound(object sender, EventArgs e)
        //{
        //    if (gvConfia.Rows.Count > 0)
        //    {
        //        painelSlider.Visible = true;
        //        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "updateSlider", "updateSlider();", true);
        //    }
        //    else
        //    {
        //        painelSlider.Visible = false;
        //    }
        //}

        //protected void gvConfia_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        //{
        //    //pega os dados da linha selecionada
        //    // adiciona os dados na sessão para busca posterior
        //    string registro = gvConfia.DataKeys[e.NewSelectedIndex]["COD_DEPARTAMENTO"].ToString().Trim();
        //    Session["cliente"] = registro;

        //    //testa aldo e direciona p/ a pag correta.
        //    if (1 == 1)
        //    {
        //        Server.Transfer("Detalhes.aspx");
        //    }
        //}

        //protected void gvConfia_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        DateTime dtVenc;
        //        if (DateTime.TryParse(((DepartamentoVO)e.Row.DataItem).DATA_LOG.ToString(), out dtVenc))
        //        {
        //            if (dtVenc.CompareTo(DateTime.Today) == 0 || dtVenc == DateTime.Today.AddDays(1) || (dtVenc.CompareTo(DateTime.Today) == -1))
        //            {
        //                ((ImageButton)e.Row.Cells[1].FindControl("btnUrgente")).ImageUrl = "~/img/iconeVermelho.png";
        //                ((ImageButton)e.Row.Cells[1].FindControl("btnUrgente")).ToolTip = "Criado em: " + dtVenc.ToString();
        //            }

        //            else
        //            {
        //                ((ImageButton)e.Row.Cells[1].FindControl("btnUrgente")).ImageUrl = "~/img/iconeVede.png";
        //                ((ImageButton)e.Row.Cells[1].FindControl("btnUrgente")).ToolTip = "Criado em: " + dtVenc.ToString();
        //            }
        //        }
        //    }
        //}

        //protected void gvConfia_PageIndexChanging(object sender, GridViewPageEventArgs e)
        //{
        //    gvConfia.PageIndex = e.NewPageIndex;
        //    loadGrid();
        //}

        private void navigationHistory()
        {
            lblHistoryNavigation.Text = String.Format("{0} >> {1} >> {2} >> ", "Confia", "Cadastros", "Departamentos");
            lblThisPage.Text = "Log de Departamentos";

        }
        private void applyText()
        {
            btnSalvar.Text = "Salvar";
            btnCancelar.Text = "Cancelar";
            lblReplacement.Text = "           ";
            lblReplacementOf.Text = "           ";
        }

        protected void lnkLog_Click(object sender, EventArgs e)
        {

        }
        //private void loadGrid()
        //{
        //    try
        //    {
        //        DepartamentoDA da = new DepartamentoDA();
        //        gvConfia.DataSource = da.getDepartamento();
        //        gvConfia.DataBind();
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }
        //}
    }
}